package net.minecraft.src;

public class LF_ModelWoodenChair extends LF_Model
{
	ModelRenderer Leg4;
	ModelRenderer Seat;
	ModelRenderer Back1;
	ModelRenderer Back2;
	ModelRenderer Back3;
	ModelRenderer Back4;
	ModelRenderer Back5;
	ModelRenderer BackTop;
	ModelRenderer Back6;
	ModelRenderer Leg2Mid;
	ModelRenderer Leg1Mid;
	ModelRenderer Leg3Mid;
	ModelRenderer RSeat;
	ModelRenderer LSeat;
	ModelRenderer BSeat;
	ModelRenderer CBack;
	ModelRenderer RTop;
	ModelRenderer LTop;
	ModelRenderer CTop;

	public LF_ModelWoodenChair(byte subType)
	{
		textureWidth = 64;
		textureHeight = 32;
		isMultiBlock = false;

		if(subType != 2)
		{
			Leg4 = new ModelRenderer(this, 0, 14).setTextureSize(64, 32);

			if(subType == 3)
				Leg4.addBox(-1F, -6F, 4F, 2, 6, 2);
			else if(subType == 4)
				Leg4.addBox(-9F, -6F, 4F, 2, 6, 2);
			else
				Leg4.addBox(4F, -6F, 4F, 2, 6, 2);

			Leg4.setRotationPoint(0F, 24F, 0F);
			setRotation(Leg4, 0F, 0F, 0F);
		}
		else
			Leg4 = null;

		Seat = new ModelRenderer(this, 0, 0).setTextureSize(64, 32);
		Seat.addBox(-6F, -7F, -6F, 12, 1, 12);
		Seat.setRotationPoint(0F, 24F, 0F);
		setRotation(Seat, 0F, 0F, 0F);

		Back1 = new ModelRenderer(this, 9, 14).setTextureSize(64, 32);

		if(subType == 1 || subType == 3)
			Back1.addBox(-7F, -15F, 4F, 1, 8, 2);
		else
			Back1.addBox(-6F, -15F, 4F, 1, 8, 2);

		Back1.setRotationPoint(0F, 24F, 0F);
		setRotation(Back1, 0F, 0F, 0F);

		Back2 = new ModelRenderer(this, 9, 14).setTextureSize(64, 32);
		Back2.addBox(-4F, -15F, 4F, 1, 8, 2);
		Back2.setRotationPoint(0F, 24F, 0F);
		setRotation(Back2, 0F, 0F, 0F);

		Back3 = new ModelRenderer(this, 9, 14).setTextureSize(64, 32);
		Back3.addBox(3F, -15F, 4F, 1, 8, 2);
		Back3.setRotationPoint(0F, 24F, 0F);
		setRotation(Back3, 0F, 0F, 0F);

		Back4 = new ModelRenderer(this, 9, 14).setTextureSize(64, 32);

		if(subType == 2 || subType == 3)
			Back4.addBox(6F, -15F, 4F, 1, 8, 2);
		else
			Back4.addBox(5F, -15F, 4F, 1, 8, 2);

		Back4.setRotationPoint(0F, 24F, 0F);
		setRotation(Back4, 0F, 0F, 0F);

		Back5 = new ModelRenderer(this, 9, 14).setTextureSize(64, 32);
		Back5.addBox(-2F, -15F, 4F, 1, 8, 2);
		Back5.setRotationPoint(0F, 24F, 0F);
		setRotation(Back5, 0F, 0F, 0F);

		BackTop = new ModelRenderer(this, 16, 14).setTextureSize(64, 32);
		BackTop.addBox(-6F, -16F, 4F, 12, 1, 2);
		BackTop.setRotationPoint(0F, 24F, 0F);
		setRotation(BackTop, 0F, 0F, 0F);

		Back6 = new ModelRenderer(this, 9, 14).setTextureSize(64, 32);
		Back6.addBox(1F, -15F, 4F, 1, 8, 2);
		Back6.setRotationPoint(0F, 24F, 0F);
		setRotation(Back6, 0F, 0F, 0F);

		Leg2Mid = new ModelRenderer(this, 0, 14).setTextureSize(64, 32);

		if(subType == 1 || subType == 3)
			Leg2Mid.addBox(-9F, -6F, 4F, 2, 6, 2);
		else if(subType == 5)
			Leg2Mid.addBox(-6F, -6F, 7F, 2, 6, 2);
		else
			Leg2Mid.addBox(-6F, -6F, 4F, 2, 6, 2);

		Leg2Mid.setRotationPoint(0F, 24F, 0F);
		setRotation(Leg2Mid, 0F, 0F, 0F);

		Leg1Mid = new ModelRenderer(this, 0, 14).setTextureSize(64, 32);

		if(subType == 1 || subType == 3 || subType == 4)
			Leg1Mid.addBox(-9F, -6F, -6F, 2, 6, 2);
		else
			Leg1Mid.addBox(-6F, -6F, -6F, 2, 6, 2);

		Leg1Mid.setRotationPoint(0F, 24F, 0F);
		setRotation(Leg1Mid, 0F, 0F, 0F);

		if(subType != 2)
		{
			Leg3Mid = new ModelRenderer(this, 0, 14).setTextureSize(64, 32);

			if(subType == 3)
				Leg3Mid.addBox(-1F, -6F, -6F, 2, 6, 2);
			else if(subType == 5)
				Leg3Mid.addBox(4F, -6F, 7F, 2, 6, 2);
			else
				Leg3Mid.addBox(4F, -6F, -6F, 2, 6, 2);

			Leg3Mid.setRotationPoint(0F, 24F, 0F);
			setRotation(Leg3Mid, 0F, 0F, 0F);
		}
		else
			Leg3Mid = null;

		if(subType == 2 || subType == 3 || subType == 5)
		{
			RSeat = new ModelRenderer(this, 16, 22).setTextureSize(64, 32);
			RSeat.addBox(-6F, -7F, 6F, 12, 1, 2);
			RSeat.setRotationPoint(0F, 24F, 0F);
			setRotation(RSeat, 0F, (float)(Math.PI/2), 0F);
		}
		else
			RSeat = null;

		if(subType == 1 || subType == 3 || subType == 4)
		{
			LSeat = new ModelRenderer(this, 16, 18).setTextureSize(64, 32);
			LSeat.addBox(-6F, -7F, -8F, 12, 1, 2);
			LSeat.setRotationPoint(0F, 24F, 0F);
			setRotation(LSeat, 0F, (float)(Math.PI/2), 0F);
		}
		else
			LSeat = null;

		if(subType == 4 || subType == 5)
		{
			BSeat = new ModelRenderer(this, 16, 26).setTextureSize(64, 32);
			BSeat.addBox(-6F, -7F, 6F, 12, 1, 2);
			BSeat.setRotationPoint(0F, 24F, 0F);
			setRotation(BSeat, 0F, 0F, 0F);
		}
		else
			BSeat = null;

		if(subType == 4 || subType == 5)
		{
			CBack = new ModelRenderer(this, 37, 0).setTextureSize(64, 32);

			if(subType == 5)
				CBack.addBox(4F, -15F, 4F, 2, 8, 2);
			else
				CBack.addBox(-6F, -15F, 4F, 2, 8, 2);

			CBack.setRotationPoint(0F, 24F, 0F);
			setRotation(CBack, 0F, 0F, 0F);
		}
		else
			CBack = null;

		if(subType != 0 && subType != 1)
		{
			RTop = new ModelRenderer(this, 26, 14).setTextureSize(64, 32);

			if(subType == 4)
				RTop.addBox(-6F, -16F, 4F, 2, 1, 2);
			else
				RTop.addBox(6F, -16F, 4F, 2, 1, 2);

			RTop.setRotationPoint(0F, 24F, 0F);
			setRotation(RTop, 0F, 0F, 0F);
		}
		else
			RTop = null;

		if(subType != 0 && subType != 2)
		{
			LTop = new ModelRenderer(this, 26, 14).setTextureSize(64, 32);

			if(subType == 5)
				LTop.addBox(4F, -16F, 4F, 2, 1, 2);
			else
				LTop.addBox(-8F, -16F, 4F, 2, 1, 2);

			LTop.setRotationPoint(0F, 24F, 0F);
			setRotation(LTop, 0F, 0F, 0F);
		}
		else
			LTop = null;

		if(subType == 4 || subType == 5)
		{
			CTop = new ModelRenderer(this, 26, 14);

			if(subType == 4)
				CTop.addBox(-6F, -16F, 6F, 2, 1, 2);
			if(subType == 5)
				CTop.addBox(4F, -16F, 6F, 2, 1, 2);

			CTop.setRotationPoint(0F, 24F, 0F);
			setRotation(CTop, 0F, 0F, 0F);
		}
		else
			CTop = null;
	}

	public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
	{
		super.render(entity, f, f1, f2, f3, f4, f5);
		setRotationAngles(f, f1, f2, f3, f4, f5);

		renderModel(f5);
	}

	public void renderModel(float f1)
	{
		renderModel(f1,(byte)0);
	}

	public void renderModel(float f1, byte subType)
	{
		if(subType != 2)
			Leg4.render(f1);

		Seat.render(f1);

		if(subType != 4 && subType != 5)
		{
			Back1.render(f1);
			Back2.render(f1);
			Back3.render(f1);
			Back4.render(f1);
			Back5.render(f1);
			BackTop.render(f1);
			Back6.render(f1);
		}

		Leg2Mid.render(f1);
		Leg1Mid.render(f1);

		if(subType != 2)
			Leg3Mid.render(f1);

		if(subType == 2 || subType == 3 || subType == 5)
			RSeat.render(f1);

		if(subType == 1 || subType == 3 || subType == 4)
			LSeat.render(f1);

		if(subType != 0 && subType != 2)
			LTop.render(f1);

		if(subType != 0 && subType != 1)
			RTop.render(f1);

		if(subType == 4 || subType == 5)
		{
			CBack.render(f1);
			BSeat.render(f1);
			CTop.render(f1);
		}
	}

	private void setRotation(ModelRenderer model, float x, float y, float z)
	{
		model.rotateAngleX = x;
		model.rotateAngleY = y;
		model.rotateAngleZ = z;
	}

	public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
	{
		super.setRotationAngles(f, f1, f2, f3, f4, f5);
	}
}
